<?php
session_start();
header("content-type:text/html; charset=utf-8");
require_once("../../utils/conn.php");

    $db = new mysql_db();
    $findVM="select visitor from myvisitor where familyNum='".$_SESSION['family_current']."'";
    $myVM=$db->data($findVM);
     if($myVM["total"]<=0){
         echo ($db->createJson(false,"","system error"));
     }else{
     $myVisitor=array();
     $visitor_data=array();
     if($myVM["data"][0]["visitor"]){
       $visitor_data= explode("|",$myVM["data"][0]["visitor"]);
     }

      if($visitor_data[0]==""){
          echo ($db->createJson(false,"","0"));
      }else{
        foreach ($visitor_data as $value) {
                 $findMB="select * from member where nickname='".$value."'";
                 $mb=$db->data($findMB);
                //$tagArr=$tagArr==""?"":json_encode($tagArr);
                foreach($mb["data"] as $val){
                     $myVisitor[]='{"familyNum":"'.$val["familyNum"].'","faceImg":"'.$val["faceImg"].'","nickname":"'.$val["nickname"].'"}';
                }
              }
               echo($db->createJson(true,json_encode($myVisitor),"success"));
      }
     }
?>